package com.fanshuai.springcloud;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.HandlerAdapter;
import org.springframework.web.servlet.HandlerMapping;

import java.util.Map;

@Slf4j
@SpringBootApplication(scanBasePackages = {"com.fanshuai.springcloud"})
@EnableDiscoveryClient
@EnableZuulProxy
public class ZuulStarter {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(ZuulStarter.class, args);

        Map<String, HandlerMapping> handlerMappingMap = context.getBeansOfType(HandlerMapping.class);
        log.info("handlerMappingMap={}", handlerMappingMap);

        Map<String, HandlerAdapter> adapterMap = context.getBeansOfType(HandlerAdapter.class);
        log.info("adapterMap={}", adapterMap);

        Map<String, ServletRegistrationBean> servletMap = context.getBeansOfType(ServletRegistrationBean.class);
        log.info("servlet map={}", servletMap);

        Map<String, FilterRegistrationBean> filterMap = context.getBeansOfType(FilterRegistrationBean.class);
        log.info("filter map={}", filterMap);
    }
}
